#ifndef __EKOS_MEMLAYOUT_H__
#define __EKOS_MEMLAYOUT_H__

#include "layout.h"

/* the 16M boundary for DMA memory */
#define DMA_BOUNDARY_PAGE (1 << 12)

#define GDT_COUNT 5 + LAPIC_COUNT
/* Global Descriptor */
#define GD_KERN_TEXT 0x08
#define GD_KERN_DATA 0x10
#define GD_USER_TEXT 0x18
#define GD_USER_DATA 0x20
#define GD_TSS(CPU) ((5 + (CPU)) << 3) 	/* Task segment selector */

//  +--4G LIMIT--------------------+
//  |                              |
//  |  Group shared pool           |
//  |                              |
//  +---KSHARE------0xf8000000-----+
#define KSHARE      0xf8000000
#define KSHARE_SIZE 0x08000000
//  |                              |
//  |   Unavailable                |
//  |                              |
//  +---KUA---------0xf7c00000-----+
#define KUA         0xf7c00000
//  |                              |
//  |         Unused               |
//  +---KDATA-------0xf4403000-----+
#define KDATA       0xf4403000
//  |   CPUPRIV     0xf4402000     |
#define CPUPRIV     0xf4402000
//  |   HPET        0xf4401000     |
#define HPET        0xf4401000
//  |   LAPIC       0xf4400000     |
#define LAPIC       0xf4400000
//  +---------------0xf4400000-----+
//  |                              |
//  |  Remap for current VPT       |
#define KTMP        (KVPT + (KUA >> 10))
//  |                              |
//  +---KVPT--------0xf4000000-----+
#define KVPT        0xf4000000
//  |                              |
//  |  Mapped to 0x0~0x04000000    |
//  |  which contain kernel image  |
//  |                              |
//  +---KBASE-------0xf0000000-----+
#define KBASE       0xf0000000
#define KSIZE       0x10000000
#define KISIZE      0x04000000
//  |                              |
//  |  Read only map for VPT       |
//  |                              |
//  +---UVPT--------0xefc00000-----+
#define UVPT        0xefc00000
//  |                              |
//  |  Read only information for   |
//  |  system and current proc     |
//  |   UCPUPRIV    0xef003000     |
#define UCPUPRIV    0xef003000
//  |   UTASK       0xef002000     |
#define UTASK       0xef002000
//  |   USYSCONF    0xef001000     |
#define USYSCONF    0xef001000
//  |   ULAPIC      0xef000000     |
#define ULAPIC      0xef000000
//  +---UINFO-UWLIM-0xef000000-----+
#define UINFO       0xef000000
#define UWLIM       0xef000000
//  |                              |
//  |  USER SPACE PROGRAM & DATA   |
//  |                              |
//  +---------------0x00000000-----+


#endif
